package us.mooresr.geartrack.server.handler;

import us.mooresr.geartrack.server.DAO;
import us.mooresr.geartrack.shared.action.DeleteLocationResult;
import us.mooresr.geartrack.shared.action.DeleteLocationAction;
import com.gwtplatform.dispatch.server.ExecutionContext;
import com.gwtplatform.dispatch.server.actionhandler.ActionHandler;
import com.gwtplatform.dispatch.shared.ActionException;

public class DeleteLocationActionHandler implements ActionHandler<DeleteLocationAction, DeleteLocationResult>{

	@Override
	public DeleteLocationResult execute(DeleteLocationAction action,
			ExecutionContext arg1) throws ActionException {
		DAO dao = new DAO();
		
		dao.ofy().delete(action.getLocationIn());
		
		return new DeleteLocationResult(action.getLocationIn());
	}

	@Override
	public Class<DeleteLocationAction> getActionType() {
		return DeleteLocationAction.class;
	}

	@Override
	public void undo(DeleteLocationAction arg0, DeleteLocationResult arg1,
			ExecutionContext arg2) throws ActionException {
		// TODO Auto-generated method stub
		
	}

}
